提示层级:从指令到逻辑
提示已从简单的命令式输入演进为复杂的推理架构,用于引导模型的内部处理路径。
核心概念
- 零样本提示:在不提供任何示例的情况下给出任务描述(例如:“将这段内容翻译成法语”)。
- 少样本提示:使用“示范”(输入-输出对)来定义标签空间和期望格式。
- 思维链(CoT):一种鼓励模型生成中间推理步骤的提示技术。
- 涌现特性:复杂推理并非显式编程,而是在参数量通常超过100亿的模型中“涌现”的。
推理范式转变
- 指令遵循:输入到输出的直接映射。
- 上下文学习:从提供的示例中学习模式(少样本)。
- 逻辑分解:将问题分解为一系列连续步骤(思维链)。
- 过程监督:优先关注“思考”步骤的准确性,而非最终答案(如 OpenAI o1 所示)。
关键洞察
在少样本场景中,模型的表现高度依赖于标签分布和示范的相关性,而不仅仅是示例的数量。
TERMINALbash — 80x24
> Ready. Click "Run" to execute.
>
Question 1
Which method relies on providing "demonstrations" to guide the model?
Question 2
True or False: Chain-of-Thought reasoning is a capability found in almost all AI models regardless of size.
Challenge: Optimizing Logic Puzzles
Scenario: Optimize a prompt for a model that is struggling with a logic puzzle.
You are using an LLM to solve the following puzzle: "A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost?"
Currently, you are passing the prompt exactly as written above, and the model incorrectly answers "$0.10".
Currently, you are passing the prompt exactly as written above, and the model incorrectly answers "$0.10".
Task 1
Identify if the current prompt is Zero-shot or Few-shot.
Solution:
The current prompt is Zero-shot because it provides the task description without any prior examples or demonstrations of similar solved puzzles.
The current prompt is Zero-shot because it provides the task description without any prior examples or demonstrations of similar solved puzzles.
Task 2
Inject the Zero-shot CoT trigger phrase to improve reasoning accuracy. Rewrite the prompt.
Solution:
"A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost? Let's think step by step:"
"A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost? Let's think step by step:"